#pragma once

#include "../../Libs/headers.default.h"
#include "../../Libs/headers.classification.h"

using namespace loirey;

namespace datasets_uci
{
	class CSingleAttributeSettings
	{
	public:
		static const int INPUT_MODE_VALUE = 0;
		static const int INPUT_MODE_ENUM = 1;
	public:
		static const int OUTPUT_MODE_VALUE = 0;
		static const int OUTPUT_MODE_BIT_MAPPING = 1;
	public:
		static const int ERROR_SUCCESSFUL = 0;
		static const int ERROR_STREAM = 1;
		static const int ERROR_MISSING = 2;
		static const int ERROR_INVALID_VALUE = 3;
	public:
		string strName;
		int InputMode;
		int OutputMode;
		bool fIgnoreLetterCase;
		CSimpleDictionary<string> EnumDict;
		string SplitChars;
		string IgnoreChars;

	public:
		CSingleAttributeSettings();
		virtual ~CSingleAttributeSettings();
		virtual void Clear();
		virtual bool LoadSettingsFromStream(istream& inStream);
		virtual void SaveSettingsToStream(ostream& outStream) const;
		virtual int GetEnumAmount() const;
		virtual int GetOutputDimension() const;
		virtual int LoadAttributeFromStream(istream& inStream, double* pDstData) const;
		//virtual void SaveAttributeToStream(ostream& outStream) const;
	};

	class CAttributeSetSettings
	{
	public:
		int AttributeAmount;
		int FeatureDimension;
		CSimpleTypeArray<CSingleAttributeSettings> PerAttSettings;
		CSimpleTypeArray<int> PerAttFeatureOffset;
		int LabelAttributePosition;
		CSingleAttributeSettings LabelAttributeSettings;

	public:
		CAttributeSetSettings();
		virtual ~CAttributeSetSettings();
		virtual void SetLabelAttributeSettings(
			int LabelAttributePosition, const CSingleAttributeSettings& SingleAttributeSettings);
		virtual void Clear();
		virtual void PushBack(const CSingleAttributeSettings& SingleAttributeSettings);
		virtual void LoadConfigFromFile(string strFN_AttributeSetSettings);
		virtual void ComputeFeatureSettings();
		virtual int LoadFeatureFromStream(
			istream& inStream, int& DstLabel, CSimpleTypeArray<double>& DstFeatureList) const;
	};

	class C_UCI_LabeledDataSet : public CLabeledDataSetForClassification_InMemory
	{
	public:
		CAttributeSetSettings* pASS;

	public:
		C_UCI_LabeledDataSet();
		virtual ~C_UCI_LabeledDataSet();
		virtual void InitAttributeSetSettings(CAttributeSetSettings* pASS);
		virtual void InitData(string strFN_Data); // Ignore examples with missing values
	};
}

